package com.cdj.common.activity.top.imp;

import android.view.View;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import com.cdj.common.R;
import com.cdj.common.activity.top.ITopBarSetting;


/**
 * ---------------------------------------------------------<br />
 * desc：<br />
 * author：chendeji <br />
 * date：2021/7/5<br />
 * email：18701434169@163.com<br />
 * qq: 781571323
 * wx: melody_2009
 * ---------------------------------------------------------<br />
 */
public class BaseToolbarSetting implements ITopBarSetting {

    private Toolbar toolbar;
    private TextView title;
    public BaseToolbarSetting(AppCompatActivity activity) {
        toolbar = activity.findViewById(R.id.toolbar);
        title = activity.findViewById(R.id.tv_title);
    }
    public BaseToolbarSetting(Toolbar view) {
        toolbar = view;
        title = view.findViewById(R.id.tv_title);
    }

    @Override
    public Toolbar getToolBar() {
        return this.toolbar;
    }

    @Override
    public void setLeftCallback(View.OnClickListener listener) {
        this.toolbar.setNavigationOnClickListener(listener);
    }

    @Override
    public void setTitle(String title) {
        this.title.setText(title);
    }

}
